Beispiel #1
0
        public static BaseActionResult DeleteHistory(History obj4delete)
        {
            using (var context = new XiaoluEntities())
            {
                string msg;
                var    repository = new HistoryRepository(context);

                if (obj4delete == null)
                {
                    msg = string.Format(XiaoluResources.MSG_DELETE_SUCCESS, XiaoluResources.STR_HISTORY) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_OBJECT_IS_NULL);
                    return(new BaseActionResult(false, msg));
                }
                repository.Delete(obj4delete);
                context.SaveChanges();
                msg = string.Format(XiaoluResources.MSG_UPDATE_SUCCESS, obj4delete.UserId);
                return(new BaseActionResult(true, msg));
            }
        }
        public static BaseActionResult DeleteHistory(History obj4delete)
        {
            using (var context = new XiaoluEntities())
            {
                string msg;
                var repository = new HistoryRepository(context);

                if (obj4delete == null)
                {
                    msg = string.Format(XiaoluResources.MSG_DELETE_SUCCESS, XiaoluResources.STR_HISTORY) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_OBJECT_IS_NULL);
                    return new BaseActionResult(false, msg);
                }
                repository.Delete(obj4delete);
                context.SaveChanges();
                msg = string.Format(XiaoluResources.MSG_UPDATE_SUCCESS, obj4delete.UserId);
                return new BaseActionResult(true, msg);
            }
        }
Beispiel #3
0
 public IActionResult Delete(int id)
 {
     _historyRepository.Delete(id);
     return(NoContent());
 }