public ActionResult Action(int?Id) { AccomodationActionModel model = new AccomodationActionModel(); if (Id.HasValue)//editing a record { var accomodation = accomodationService.GetAccomodationId(Id.Value); model.Id = accomodation.Id; model.Name = accomodation.Name; model.Description = accomodation.Description; model.AccomodationPackageId = accomodation.AccomodationPackageId; } model.AccomodationPackages = accomodationPackageService.GetAllAccomodationPackage(); return(PartialView("_Action", model)); //else//creating a new record //{ //} }