Example #1
0
        // POST api/<controller>
        public int Post([FromBody] EmpPerReviewPerformanceModel model)
        {
            if (model != null)
            {
                if (model.EmpReviewID == 0)
                {
                    model.CreatedBy   = base.UserName;
                    model.CreatedDate = DateTime.Now;
                    model.Status      = true;
                    model.EmpID       = int.Parse(base.UserIdentity);
                    model.RepMgrID    =
                        int.Parse(base.UserIdentity) != model.EmpID
                            ? model.EmpID
                            : null; // empid may be login or selected empid
                    //model.RepMgrID = base.ReportingManagerId;
                    foreach (var segments in model.tblEmpPerReviewSegments)
                    {
                        foreach (var question in segments.tblEmpPerReviewRatings)
                        {
                            question.CreatedDate = DateTime.Now;
                            question.CreatedBy   = base.UserName;
                        }
                    }

                    return(_empMgrReviewService.Save(model));
                }
                else
                {
                    model.UpdatedBy   = base.UserName;
                    model.UpdatedDate = DateTime.Now;
                    model.Status      = true;
                    model.EmpID       = int.Parse(base.UserIdentity);
                    model.RepMgrID    = int.Parse(base.UserIdentity) != model.EmpID ? model.EmpID : null;// empid may be login or selected empid
                    //model.RepMgrID = base.ReportingManagerId;
                    foreach (var segments in model.tblEmpPerReviewSegments)
                    {
                        foreach (var question in segments.tblEmpPerReviewRatings)
                        {
                            question.UpdatedDate = DateTime.Now;
                            question.UpdatedBy   = base.UserName;
                        }
                    }
                    return(_empMgrReviewService.Update(model));
                }
            }

            return(0);
        }
Example #2
0
 // POST api/<controller>
 public void Post([FromBody] EmpPerReviewPerformanceModel model)
 {
     _empMgrReviewService.Save(model);
 }