Пример #1
0
 public HttpResponseMessage Post([FromBody] Models.bank oBank, long created_by)
 {
     try
     {
         Models.bank insertBank = new Models.bank
         {
             bank_name    = oBank.bank_name,
             is_active    = oBank.is_active,
             is_deleted   = false,
             created_by   = created_by,
             created_date = DateTime.Now
         };
         if (bankRepository.DuplicateCheck(oBank.bank_name))
         {
             var formatter = RequestFormat.JsonFormaterString();
             return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                 output = "warning", msg = "Bank name is duplicate"
             }, formatter));
         }
         else
         {
             bool save_bank_branch = bankRepository.InsertBank(insertBank);
             var  formatter        = RequestFormat.JsonFormaterString();
             return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                 output = "success", msg = "Bank save successfully"
             }, formatter));
         }
     }
     catch (Exception ex)
     {
         var formatter = RequestFormat.JsonFormaterString();
         return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
             output = "error", msg = ex.ToString()
         }, formatter));
     }
 }