public SGMLactor(Uri url, int type) { this._uri = url; _flat = new flat(); string adv_number = url.Segments[url.Segments.Length-1]; _flat.uid = int.Parse(adv_number.Split('.')[0]); _type = (RealtyType)type; }
public ActionResult AddEstateObject(int realtyType) { EstateObjectViewModel model = _estateObjectService.Model(); Agency db = new Agency(); RealtyType result = db.RealtyTypes.FirstOrDefault(f => f.Id == realtyType); model.RealtyTypeId = realtyType; model.RealtyType = result.Name; return(View(model)); }
public async Task <ActionResult> AddEstateObject(EstateObjectViewModel model) { if (!ModelState.IsValid) { Agency db = new Agency(); RealtyType result = db.RealtyTypes.FirstOrDefault(f => f.Id == model.RealtyTypeId); model = _estateObjectService.Model(); model.RealtyTypeId = result.Id; model.RealtyType = result.Name; return(View(model)); } EstateObject eo = await _estateObjectService.EstateObject(model); eo.StatusId = 1; await _estateObjectService.AddEstateObject(eo); return(RedirectToAction("Index")); }