Example #1
0
 public PLandlord SavePLandlord(PLandlord pLandlord, int userId)
 {
     pLandlord.LandlordAdded = DateTime.UtcNow;
     pLandlord.DateCreated   = DateTime.UtcNow;
     pLandlord.DateUpdated   = DateTime.UtcNow;
     pLandlord.UpdatedUserId = userId;
     _currentDbContext.PLandlords.Add(pLandlord);
     _currentDbContext.SaveChanges();
     return(pLandlord);
 }
 public JsonResult _LandlordSubmit(PLandlord model)
 {
     try
     {
         model = PropertyService.SavePLandlord(model, CurrentUserId);
         return(Json(new { error = false, id = model.PLandlordId, code = model.LandlordCode }));
     }
     catch (Exception exp)
     {
         return(Json(new { error = true, msg = exp.Message }));
     }
 }
        public ActionResult Edit([Bind(Include = "PLandlordId,LandlordCode,LandlordFullname,LandlordSalutation,LandlordStatus,LandlordAdded,LandlordNotes1,LandlordNotes2,UserNotes1,UserNotes2,SiteId,SyncRequiredFlag,AddressLine1,AddressLine2,AddressLine3,AddressLine4,AddressPostcode,HomeTelephone,WorkTelephone1,WorkTelephone2,WorkTelephoneFax,MobileNumber,Email")] PLandlord pLandlord)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }
            if (ModelState.IsValid)
            {
                PropertyService.SavePLandlord(pLandlord, CurrentUserId);

                return(RedirectToAction("Index"));
            }
            return(View(pLandlord));
        }
        // GET: PLandlords/Edit/5
        public ActionResult Edit(int?id)
        {
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PLandlord pLandlord = PropertyService.GetPropertyLandlordById(id ?? 0);

            if (pLandlord == null)
            {
                return(HttpNotFound());
            }
            return(View(pLandlord));
        }