Exemple #1
0
        public JsonResult AddInspection(InspectionModel model)
        {
            var user  = User.Identity.Name;
            var files = Request.Files;
            var login = AccountService.GetLoginByEmail(user);

            if (ModelState.IsValid)
            {
                var result = TenantService.AddInspection(model, login, Request.Files);
                if (result.IsSuccess)
                {
                    return(Json(new { Success = true, Message = "Sucessfully Replied to the Property Owner's Request", Posted = true }));
                }
                else
                {
                    return(Json(new { Success = false, ErrorMsg = result.ErrorMessage }));
                }
            }
            return(Json(new { Success = false, ErrorMsg = "Invalid fields" }));
        }