Ejemplo n.º 1
0
        public IActionResult DeleteConfirmed(int id)
        {
            var member = _member.GetById(id);

            if (member == null)
            {
                return(RedirectToAction(nameof(Index)));
            }

            try
            {
                _member.Delete(id);
                _loan.DeleteWithMemberId(id);
                return(RedirectToAction(nameof(Index)));
            }
            catch (DbUpdateException)
            {
                return(RedirectToAction(nameof(Delete), new { id = id, savesaveChangesError = true }));
            }
        }
 public IActionResult Delete(Guid id)
 {
     try
     {
         if (id == null)
         {
             return(StatusCode(400, $"ID is not valid."));
         }
         else
         {
             var res = _member.Delete(id);
             return(Json(res));
         }
     }
     catch (Exception ex)
     {
         _logger.LogCritical($"Exception while get list of items.", ex);
         return(StatusCode(500, $"Exception while get list of items. {ex.Message}"));
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 删除一个实体
 /// </summary>
 /// <param name="_entity"></param>
 /// <returns></returns>
 public int Delete(int m_id)
 {
     return(dal.Delete(m_id));
 }