CSHARP 15
Erc cmc replace controller Guest on 26th July 2025 12:04:27 PM
  1. [HttpPost]
  2. public JsonResult ReplaceWeekAttendance_CMC([FromBody] List<AttendanceJson> jsondata)
  3. {
  4.     try
  5.     {
  6.         var jsonString = JsonConvert.SerializeObject(jsondata);
  7.         _dbContext.ReplaceWeekAttendance_CMC(jsonString);
  8.  
  9.         return new JsonResult(new
  10.         {
  11.             message = "Done",
  12.         });
  13.     }
  14.     catch (Exception ex)
  15.     {
  16.         return new JsonResult(500, new
  17.         {
  18.             message = "There was an Error",
  19.             error = ex.Message
  20.         });
  21.     }
  22.  
  23. }
  24.  
  25. [HttpPost]
  26. public JsonResult ReplaceWeekAttendance_ERC([FromBody] List<AttendanceJson> jsondata)
  27. {
  28.     try
  29.     {
  30.         var jsonString = JsonConvert.SerializeObject(jsondata);
  31.         _dbContext.ReplaceWeekAttendance_ERC(jsonString);
  32.  
  33.         return new JsonResult(new
  34.         {
  35.             message = "Done",
  36.         });
  37.     }
  38.     catch (Exception ex)
  39.     {
  40.         return new JsonResult(500, new
  41.         {
  42.             message = "There was an Error",
  43.             error = ex.Message
  44.         });
  45.     }
  46.  
  47. }
  48. [HttpPost]
  49. public JsonResult GetWeekAttendanceERC(DateTime StartWeek)
  50. {
  51.     List<GetWeekAttendance> result = new List<GetWeekAttendance>();
  52.     try
  53.     {
  54.         result = _dbContext.GetWeekAttendance_ERC(StartWeek);
  55.         return new JsonResult(result);
  56.     }
  57.     catch(Exception ex) {
  58.         return new JsonResult(500, new
  59.         {
  60.             message = "There was an Error",
  61.             error = ex.Message
  62.         });
  63.     }
  64.  
  65.  
  66.    
  67. }

Hightechrobo bin is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.