public ActionResult EditPropertyFeature(Guid propertyId, byte featureId, PropertyFeatureDetailDTO featureDetail) { if (ModelState.IsValid) { PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector); PartnerBLL.UpdatePropertyFeatureDetailResult result = partnerBLL.UpdatePropertyFeature(Account, propertyId, featureId, featureDetail); switch (result) { case PartnerBLL.UpdatePropertyFeatureDetailResult.OK: TempData["Result"] = "PropertyFeatureDetailHasBeenEdited"; return(RedirectToAction("ViewProperty", new { id = propertyId })); case PartnerBLL.UpdatePropertyFeatureDetailResult.NotFound: return(HttpNotFound()); case PartnerBLL.UpdatePropertyFeatureDetailResult.FeatureAlreadyAdded: AddError("Feature", "FeatureAlreadyAdded"); EditPropertyFeature_Base(propertyId); return(View(featureDetail)); default: return(BadRequest()); } } else { EditPropertyFeature_Base(propertyId); return(BadRequestWithErrors()); } }
public ActionResult DeletePropertyFeature(Guid propertyId, byte featureId) { PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector); if (Request.HttpMethod == "GET") { PropertyFeatureDetailDTO featureDetail = partnerBLL.ReadPropertyFeatureDetailById(Account, propertyId, featureId); if (featureDetail != null) { ViewBag.PropertyId = propertyId; return(View(featureDetail)); } else { return(HttpNotFound()); } } else { PartnerBLL.DeletePropertyFeatureDetailResult result = partnerBLL.DeletePropertyFeatureDetail(Account, propertyId, featureId); switch (result) { case PartnerBLL.DeletePropertyFeatureDetailResult.OK: TempData["Result"] = "PropertyFeatureDetailHasBeenDeleted"; return(RedirectToAction("ViewProperty", new { id = propertyId })); case PartnerBLL.DeletePropertyFeatureDetailResult.NotFound: return(HttpNotFound()); default: return(BadRequest()); } } }
public ActionResult AddPropertyFeature(Guid id, PropertyFeatureDetailDTO featureDetail) { if (ModelState.IsValid) { PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector); PartnerBLL.AddPropertyFeatureDetailResult result = partnerBLL.AddPropertyFeatureDetail(Account, id, featureDetail); switch (result) { case PartnerBLL.AddPropertyFeatureDetailResult.OK: TempData["Result"] = "PropertyFeatureDetailHasBeenAdded"; return(RedirectToAction("ViewProperty")); case PartnerBLL.AddPropertyFeatureDetailResult.NotFound: return(HttpNotFound()); case PartnerBLL.AddPropertyFeatureDetailResult.FeatureAlreadyAdded: AddError("Feature", "FeatureAlreadyAdded"); AddEditPropertyFeature_Base(id); return(View(featureDetail)); default: return(BadRequest()); } } else { return(AddEditPropertyFeature_Base(id) != null?BadRequestWithErrors() as ActionResult : HttpNotFound()); } }
public ActionResult EditPropertyFeature(Guid propertyId, byte featureId) { PartnerBLL partnerBLL = new PartnerBLL(WebApp.Connector); PropertyFeatureDetailDTO featureDetail = partnerBLL.ReadPropertyFeatureDetailById(Account, propertyId, featureId); EditPropertyFeature_Base(propertyId); return(View(featureDetail)); }
public void Insert(PropertyFeatureDetailDTO featureDetail) { Connector.ExecuteNonQuery(insertQuery, new Dictionary <string, object>() { { "Property", featureDetail.Property }, { "Feature", featureDetail.Feature }, { "Value", featureDetail.Value } }); }
public CreateResult Create(PropertyFeatureDetailDTO featureDetail) { try { Repository.Insert(featureDetail); return(CreateResult.OK); } catch (Exception exception) { if (exception.Message.Contains("PK_Business_PropertyFeatureDetail")) { return(CreateResult.FeatureAlreadyAdded); } else { throw exception; } } }
public AddPropertyFeatureDetailResult AddPropertyFeatureDetail(PartnerDTO partner, Guid propertyId, PropertyFeatureDetailDTO featureDetail) { Connector.IsTransaction = true; try { PropertyBLL propertyBLL = new PropertyBLL(Connector); PropertyDTO property = propertyBLL.ReadById(propertyId); if (property.Partner.Id == partner.Id) { PropertyFeatureDetailBLL propertyFeatureDetailBLL = new PropertyFeatureDetailBLL(Connector); featureDetail.Property = property; PropertyFeatureDetailBLL.CreateResult result = propertyFeatureDetailBLL.Create(featureDetail); if (result == PropertyFeatureDetailBLL.CreateResult.OK) { Connector.CommitTransaction(); return(AddPropertyFeatureDetailResult.OK); } else { Connector.RollbackTransaction(); if (result == PropertyFeatureDetailBLL.CreateResult.FeatureAlreadyAdded) { return(AddPropertyFeatureDetailResult.FeatureAlreadyAdded); } else { return(AddPropertyFeatureDetailResult.NotFound); } } } else { return(AddPropertyFeatureDetailResult.NotFound); } } catch (Exception exception) { Connector.RollbackTransaction(); throw exception; } }