private UserBlock ConvertToDM(UserBlockBM model) { return new UserBlock { Id = model.Id, CurrentUserId = model.CurrentUserId, ShareUserId = model.ShareUserId, IsBlock = model.IsBlock, IsFollow = model.IsFollow, CreationDate = model.CreationDate, CreatedBy = model.CreatedBy, ModificationDate = model.ModificationDate, ModifiedBy = model.ModifiedBy, Active = model.Active, IsDeleted = model.IsDeleted }; }
public JsonResult UserFollow(int Id) { UserBlockBL UserBlockBL = new UserBlockBL(); UserBlockBM UserBlockBM = new UserBlockBM(); UserBM userObj = SessionManager.InstanceCreator.Get<UserBM>(SessionKey.User); if (userObj != null) { UserBlockBM = UserBlockBL.GetUserBlockByUserIdAndSharedUserId(userObj.Id, Id); if (UserBlockBM == null) { UserBlockBM.CurrentUserId = userObj.Id; UserBlockBM.ShareUserId = Id; UserBlockBM.IsFollow = true; UserBlockBM.CreationDate = DateTime.Now; UserBlockBM.CreatedBy = userObj.Id; UserBlockBL.Create(UserBlockBM); return Json("Changes Saved Successfully.", JsonRequestBehavior.AllowGet); } else { if (UserBlockBM.IsFollow) UserBlockBM.IsFollow = false; else UserBlockBM.IsFollow = true; UserBlockBL.Update(UserBlockBM); return Json("Changes Saved Successfully.", JsonRequestBehavior.AllowGet); } } else { return Json("Error-Please Login.", JsonRequestBehavior.AllowGet); } }
public void Update(UserBlockBM model) { uow.UserBlockRepository.Update(ConvertToDM(model)); uow.Save(); }
public void Create(UserBlockBM model) { uow.UserBlockRepository.Add(ConvertToDM(model)); uow.Save(); }