public JsonResult Add(CreateLandlordTemplateAreaItemRequest request)
        {
            if (request.LandlordTemplateAreaItemID <= 0)
            {
                LandlordTemplateAreaItem landlordTemplateAreaItem = new LandlordTemplateAreaItem();
                landlordTemplateAreaItem.LandlordTemplateAreaItemID = request.LandlordTemplateAreaItemID;
                landlordTemplateAreaItem.ItemName = request.ItemName;
                landlordTemplateAreaItem.ItemOrder = request.ItemOrder;

                db.LandlordTemplateAreaItems.Add(landlordTemplateAreaItem);
                db.SaveChanges();
            }
            else
            {
                LandlordTemplateAreaItem landlordTemplateAreaItem = db.LandlordTemplateAreaItems.Where(x => x.LandlordTemplateAreaItemID == request.LandlordTemplateAreaItemID).FirstOrDefault();
                if (landlordTemplateAreaItem != null)
                {
                    landlordTemplateAreaItem.LandlordTemplateAreaItemID = request.LandlordTemplateAreaItemID;
                    landlordTemplateAreaItem.ItemName = request.ItemName;
                    landlordTemplateAreaItem.ItemOrder = request.ItemOrder;


                    db.SaveChanges();
                }

            }

            return Json("true");
        }
        public JsonResult AddedLandlordTemplateAreaItem(LandlordTemplateAreaItemResponse model)
        {
            CreateLandlordTemplateAreaItemRequest request = new CreateLandlordTemplateAreaItemRequest();
            request.LandlordTemplateAreaItemID = model.LandlordTemplateAreaItemID;
            request.LandlordTemplateAreaItemID = model.LandlordTemplateAreaItemID;
            request.ItemName = model.ItemName;
            request.ItemOrder = model.ItemOrder;

            var result = ApiWrapper.Post<LandlordTemplateAreaItemResponse>("api/landlordtemplateareaitem/add", request);

            return Json(result);
        }
        public JsonResult Save(List<LandlordTemplateArea> areas)
        {
            SaveLandlordTemplatesRequest request = new SaveLandlordTemplatesRequest();
            request.Areas = new List<CreateLandlordTemplateAreaRequest>();
            if (areas != null)
            {
                foreach (var area in areas)
                {
                    CreateLandlordTemplateAreaRequest areaRequest = new CreateLandlordTemplateAreaRequest();
                    areaRequest.AreaName = area.Name;
                    areaRequest.AreaOrder = area.Order;
                    areaRequest.Items = new List<CreateLandlordTemplateAreaItemRequest>();
                    if (area.Items != null)
                    {
                        foreach (var item in area.Items)
                        {
                            CreateLandlordTemplateAreaItemRequest itemRequest = new CreateLandlordTemplateAreaItemRequest();
                            itemRequest.ItemName = item.Name;
                            itemRequest.ItemOrder = item.Order;

                            areaRequest.Items.Add(itemRequest);
                        }
                    }
                    request.Areas.Add(areaRequest);
                }
            }
            var response = ApiWrapper.Post<bool>("api/save-templates", request);

            return Json(true);
        }