public ActionResult Save(HrmDepartment hrmDepartment)
        {
            int userId = Convert.ToInt32(Session["userId"]);
            Operation objOperation = new Operation { Success = false };

            if (ModelState.IsValid)
            {
                if (hrmDepartment.Id == 0)
                {
                    if ((bool)Session["Add"])
                    {
                        hrmDepartment.CreatedBy = userId;
                        hrmDepartment.CreatedDate = DateTime.Now.Date;
                        objOperation = _departmentService.Save(hrmDepartment);
                    }
                    else { objOperation.OperationId = -1; }

                }
                else
                {
                    if ((bool)Session["Edit"])
                    {
                        hrmDepartment.ModifiedBy = userId;
                        hrmDepartment.ModifiedDate = DateTime.Now.Date;
                        objOperation = _departmentService.Update(hrmDepartment);
                    }
                    else { objOperation.OperationId = -2; }
                }
            }

            return Json(objOperation, JsonRequestBehavior.DenyGet);
        }
        public Operation Delete(HrmDepartment objHrmDepartment)
        {
            Operation objOperation = new Operation { Success = true, OperationId = objHrmDepartment.Id };
            _hrmDepartmentRepository.Delete(objHrmDepartment);

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception)
            {

                objOperation.Success = false;
            }
            return objOperation;
        }
        public Operation Save(HrmDepartment objHrmDepartment)
        {
            Operation objOperation = new Operation { Success = true };

            long Id = _hrmDepartmentRepository.AddEntity(objHrmDepartment);
            objOperation.OperationId = Id;

            try
            {
                _unitOfWork.Commit();
            }
            catch (Exception ex)
            {
                objOperation.Success = false;
            }
            return objOperation;
        }