public int PostPropertyAd(CategoryPropertyVM newProp) { var newPropAd = new Advertise() { Title = newProp.Title, Description = newProp.Description, CategoryId = newProp.CategoryId, Price = Convert.ToDecimal(newProp.Price), LocationId = newProp.LocationId }; db.Advertise.Add(newPropAd); db.SaveChanges(); int newAdID = newPropAd.AdvId; var newPropCat = new CategoryProperty() { AdvId = newAdID, Type = newProp.Type, Bedrooms = newProp.Bedrooms, Bathrooms = newProp.Bathrooms, Furnishing = newProp.Furnishing, Construction = newProp.Construction, ListedBy = newProp.ListedBy, BuiltupArea = newProp.BuiltupArea, CarpetArea = newProp.CarpetArea, Maintenance = newProp.Maintenance, TotalFloors = newProp.TotalFloors, FloorNo = newProp.FloorNo, CarParking = newProp.CarParking, VastuCompliant = newProp.VastuCompliant, MealInclude = newProp.MealInclude, PropertyType = newProp.PropertyType }; db.CategoryProperty.Add(newPropCat); db.SaveChanges(); return(newPropCat.Id); }
/// <summary> /// 转换分类视图和分类实体 /// </summary> /// <param name="data"></param> /// <returns></returns> private CategoryProperty CovertVMtoEntity(CategoryPropertyVM data) { CategoryProperty msg = data.ConvertVM <CategoryPropertyVM, CategoryProperty>(); msg.Property = data.Property.ConvertVM <PropertyVM, PropertyInfo>(); msg.PropertyGroup = data.PropertyGroup.ConvertVM <PropertyGroupInfoVM, PropertyGroupInfo>((v, t) => { t.PropertyGroupName = new LanguageContent(v.PropertyGroupName); }); msg.CategoryInfo = data.CategoryInfo.ConvertVM <CategoryVM, CategoryInfo>((v, t) => { t.CategoryName = new LanguageContent(v.CategoryName); }); msg.SysNo = data.SysNo; return(msg); }
public int PostAdProperty(CategoryPropertyVM objPropCat) { return(postAdModel.PostPropertyAd(objPropCat)); }
/// <summary> /// 修改分类属性 /// </summary> /// <param name="data"></param> /// <param name="callback"></param> public void UpdateCategoryProperty(CategoryPropertyVM data, EventHandler <RestClientEventArgs <CategoryProperty> > callback) { _restClient.Update(UPdateRelativeUrl, CovertVMtoEntity(data), callback); }