Пример #1
0
        public void Delete(int id)
        {
            var entity = repository.GetById(id);

            repository.Delete(entity);
            Save();
        }
Пример #2
0
        public Designation DeleteDesignation(DeleteDesignationInput designation)
        {
            var designationToDelete = _designationRepository.GetSingle(b => b.Id == designation.Id);

            _designationRepository.Delete(designationToDelete);
            _designationRepository.Commit();

            return(designationToDelete);
        }
Пример #3
0
        public async Task <IActionResult> DeleteConfirmed(long id)
        {
            //var designation = await _context.Designations.FindAsync(id);
            //_context.Designations.Remove(designation);
            //await _context.SaveChangesAsync();
            var designation = designationRepository.GetDelete(id);
            await designationRepository.Delete(designation);

            return(RedirectToAction(nameof(Index)));
        }
Пример #4
0
        public ActionResult Delete(int id)
        {
            var apiResult = TryExecute(() =>
            {
                _designationRepository.Delete(id);
                _unitOfWork.Commit();
                return(true);
            }, "Designation deleted sucessfully");

            return(Json(apiResult, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public IActionResult DeleteDesignation(long id)
        {
            Designation a = Designation_repo.Find(id);

            if (a == null)
            {
                return(NotFound());
            }
            Designation_repo.Delete(a);
            return(Ok());
        }
Пример #6
0
        /// <summary>
        /// Delete Designation by id
        /// </summary>
        public void DeleteDesignation(long designationId)
        {
            Designation dbversion = designationRepository.Find((int)designationId);

            ValidateBeforeDeletion(designationId);
            if (dbversion == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
                                                                  "Designation with Id {0} not found!", designationId));
            }
            designationRepository.Delete(dbversion);
            designationRepository.SaveChanges();
        }
        public async Task <IActionResult> Delete(int Id)
        {
            try
            {
                var designation = await _repository.Delete(Id);

                return(Ok(designation));
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #8
0
        public string Delete(int id)
        {
            string message = "";

            try
            {
                int result = _designationRepository.Delete(id);
                message = _messageClass.ShowDeleteMessage(result);
            }
            catch (SqlException ex)
            {
                message = _messageClass.ShowErrorMessage(string.Format("{0} ~ {1}", ex.Number.ToString(), ex.Message));
            }
            return(message);
        }
Пример #9
0
        public bool DeleteDesignation(int id)
        {
            bool isSuccess   = true;
            var  designation = designationRepository.GetById(id);

            try
            {
                designationRepository.Delete(designation);
                SaveRecord();
                ServiceUtil <Designation> .WriteActionLog(id, ENUMOperation.DELETE);
            }
            catch (Exception ex)
            {
                isSuccess = false;
                logger.Error("Error in deleting Designation", ex);
            }
            return(isSuccess);
        }
Пример #10
0
        public Message Delete(int designationId)
        {
            var message = new Message();

            try
            {
                int result = _iDesignationRepository.Delete(designationId);

                if (result > 0)
                {
                    message = Message.SetMessages.SetSuccessMessage("Designation Deleted Successfully.");
                }
                else
                {
                    message = Message.SetMessages.SetErrorMessage("Failed to Delete Data.");
                }
            }
            catch (Exception ex)
            {
                message = Message.SetMessages.SetErrorMessage(ex.Message);
            }

            return(message);
        }