コード例 #1
0
ファイル: BaseLogic.cs プロジェクト: Capsonic/migrationNG4
        public virtual CommonResponse Activate(int id)
        {
            CommonResponse response = new CommonResponse();

            try
            {
                using (var transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        repository.byUserId = loggedUser.UserID;
                        repository.Activate(id);

                        transaction.Commit();
                    }
                    catch (Exception e)
                    {
                        transaction.Rollback();
                        return(response.Error("ERROR: " + e.ToString()));
                    }
                }
            }
            catch (Exception e)
            {
                return(response.Error("ERROR: " + e.ToString()));
            }
            return(response.Success(id));
        }
コード例 #2
0
 public HttpResponseMessage ActivateContact(int id)
 {
     try
     {
         var result = _contactRepository.Activate(id);
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, result);
         return response;
     }
     catch (Exception ex)
     {
         HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.BadRequest, ex.Message);
         return response;
     }
 }
コード例 #3
0
 public void Activate(T model)
 {
     repo.Activate(model);
 }