I have an object/entity called 'Space'. I want to put each of the different entities (images, details, location, etc) inside 'Space' onto different pages/views so that each part can be edited separately, the user clicks on nav links to edit each section.
I don't want to have to fetch the entity from the database every time it posts back to another action. Isn't there a better way to do this?
Maybe having each one of these as action methods (location, images, details) isn't the correct approach? Please advise! Thanks.
Ex.
> https://localhost:12345/managespaces/123/images // you see the form to edit pics for id 123
> https://localhost:12345/managespaces/123/location //here you only edit loc details for id 123
> https://localhost:12345/managespaces/123/details //here details are edited for id 123
etc...
public class Space
{
public int SpaceId { get; set; }
[Index(IsUnique = false)]
[Required]
[MaxLength(128)]
public string AspNetUserRefId { get; set; }
public virtual SpaceOverview Overview { get; set; }
public virtual SpaceDetails Details { get; set; }
public virtual ICollection<SpaceImage> Images { get; set; }
public virtual SpaceListing Listing { get; set; }
public virtual SpaceAddress Location { get; set; }
public virtual ICollection<SpaceReview> Reviews { get; set; }
[Required]
public DateTime DateCreated { get; set; }
[Required]
public SpaceStatus Status { get; set; }
public virtual ICollection<SpaceEvent> Events { get; set; }
}
You need SPA concept in order to implement this. It's like READ once and manipulate everything in CLIENT side before POSTING it to the server if you want to save into DB.
Member
37 Points
195 Posts
Editing a single entity across different controller views w/out calling db with each action?
Mar 05, 2015 03:27 PM|chuckdawit|LINK
I have an object/entity called 'Space'. I want to put each of the different entities (images, details, location, etc) inside 'Space' onto different pages/views so that each part can be edited separately, the user clicks on nav links to edit each section. I don't want to have to fetch the entity from the database every time it posts back to another action. Isn't there a better way to do this?
Maybe having each one of these as action methods (location, images, details) isn't the correct approach? Please advise! Thanks.
Ex.
> https://localhost:12345/managespaces/123/images // you see the form to edit pics for id 123
> https://localhost:12345/managespaces/123/location //here you only edit loc details for id 123
> https://localhost:12345/managespaces/123/details //here details are edited for id 123
etc...
ajax mvc EntityFramework
Member
710 Points
225 Posts
Re: Editing a single entity across different controller views w/out calling db with each action?
Mar 13, 2015 11:30 AM|itpreneur|LINK
You need SPA concept in order to implement this. It's like READ once and manipulate everything in CLIENT side before POSTING it to the server if you want to save into DB.
ajax mvc EntityFramework