Exemplo n.º 1
0
        public async Task <ActionResult> Resignation(ResignationViewModel reg, Int64 ReasonId, string RelievingReason)
        {
            string        UserId     = User.Identity.GetUserId();
            UserViewModel userDetail = generic.GetUserDetail(UserId);


            var      empjoiningdetails = db.EmpJoiningDetail.Where(e => e.UserId == UserId).FirstOrDefault();
            var      dateofresignation = DateTime.UtcNow;
            DateTime lastworkingday    = dateofresignation.AddDays(empjoiningdetails.NoticePeriod);

            reg.DateofResignation = dateofresignation;
            reg.RelievingReason   = RelievingReason;
            reg.ReasonId          = ReasonId;
            reg.LastWorkingDate   = lastworkingday;
            reg.Status            = 0;
            reg.UserId            = UserId;
            reg.AprrovedOn        = DateTime.UtcNow;
            bool res = ems.Addresignation(reg);

            if (userDetail.Role != "Admin")
            {
                string callbackUrl = await SendResignationEmailTokenAsync(userDetail.ReportingAuthority, userDetail.ReportingAuthorityname, userDetail.Name, reg.Reason, reg.RelievingReason, reg.DateofResignation, "Req");
            }
            return(Json(res, JsonRequestBehavior.AllowGet));
        }