public ActionResult DeleteMembership(int id)
        {
            var profileData = this.Session["UserProfile"] as UserSession;

            if (profileData == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            try
            {
                MembershipRepository CrgRepo = new MembershipRepository();
                if (CrgRepo.DeleteMembership(id))
                {
                    ViewBag.AlertMsg = "Employee details deleted successfully";
                }
                LogModel logModel = new LogModel()
                {
                    UserId    = profileData.UserID,
                    TableName = "Membership",
                    Activity  = "Deleted Membership",
                    LogDate   = DateTime.Now
                };
                logRepository logRepository = new logRepository();
                logRepository.AddLog(logModel);
                return(RedirectToAction("GetAllMembershipDetails"));
            }
            catch
            {
                return(RedirectToAction("GetAllMembershipDetails"));
            }
        }
 public MembershipModel DeleteMembership(long membershipId)
 {
     try
     {
         return(_membershipRepository.DeleteMembership(membershipId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#3
0
        public ActionResult Delete(Guid id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                List <MembershipModel> memberships = membershipsRepository.GetAllMembershipsByMembershipTypeId(id);
                foreach (MembershipModel membership in memberships)
                {
                    membershipsRepository.DeleteMembership(membership.IDMembership);
                }
                membershipTypeRepository.DeleteMembershipType(id);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View("Delete"));
            }
        }