Beispiel #1
0
        public JsonResult AddJobRequest(MarketJobModel model)
        {
            var user    = User.Identity.Name;
            var files   = Request.Files;
            var login   = AccountService.GetLoginByEmail(user);
            var request = PropertyService.GetPropertyRequestById(model.RequestId);

            if (request == null)
            {
                return(Json(new { Success = false, Message = "No record found!" }));
            }
            if (request.RequestStatusId == (int)JobRequestStatus.Accepted)
            {
                return(Json(new { Success = true, Message = "Job Already Created !!", Posted = false }));
            }
            //request.RequestStatusId = (int)JobRequestStatus.Accepted;
            //request.IsUpdated = true;
            if (ModelState.IsValid)
            {
                var result = RentalService.AddTenantJobRequest(model, login, Request.Files);
                if (result.IsSuccess)
                {
                    return(Json(new { Success = true, Message = "Job Created And Updated", Posted = true }));
                }
                else
                {
                    return(Json(new { Success = false, ErrorMsg = result.ErrorMessage }));
                }
            }
            return(Json(new { Success = false, ErrorMsg = "Invalid fields" }));
        }